"
I represent a simple tab
I have a IconicListItem which wrap my label and my icon.
I also have a morph to display when selected.
This morph can in fact be anything responding to #asMorph. Moreover it could be a block for lazy initialization.

I also have a state representing if I am selecting or not, enabled or not, etc
"
Class {
	#name : 'TabMorph',
	#superclass : 'Morph',
	#instVars : [
		'closeable',
		'label',
		'morph',
		'state',
		'fadeOut',
		'retrievingBlock',
		'closeIcon',
		'actions',
		'menu',
		'retrievingProcess',
		'retrievingSemaphore',
		'model'
	],
	#classVars : [
		'Icons'
	],
	#category : 'Morphic-Widgets-Tabs-Morphs',
	#package : 'Morphic-Widgets-Tabs',
	#tag : 'Morphs'
}

{ #category : 'icons' }
TabMorph class >> closeHalfOverIcon [

	^ Icons
		at: #closeHalfOverIcon
		ifAbsentPut: [ self closeHalfOverIconContents ]
]

{ #category : 'icons - contents' }
TabMorph class >> closeHalfOverIconContents [

	^ Form
		extent: 12@12
		depth: 32
		fromArray: #(16777215 16777215 16777216 869400576 1523908608 1943339008 1943339008 1523908608 869400576 16777216 16777215 16777215 16777215 232259584 1624571904 2161311744 2161311744 2161311744 2161311744 2161311744 2161311744 1624571904 232259584 16777215 16777216 1624571904 3262657845 3429841466 2161311744 2161311744 2161311744 2161311744 3429841466 3262657845 1624571904 16777216 869400576 2161311744 3429841466 4283256141 3413129529 2161311744 2161311744 3413129529 4283256141 3429841466 2161311744 869400576 1523908608 2161311744 2161311744 3413129529 4283256141 3396352313 3396352313 4283256141 3413129529 2161311744 2161311744 1523908608 1943339008 2161311744 2161311744 2161311744 3396352313 4283256141 4283256141 3396352313 2161311744 2161311744 2161311744 1943339008 1943339008 2161311744 2161311744 2161311744 3396352313 4283256141 4283256141 3396352313 2161311744 2161311744 2161311744 1943339008 1523908608 2161311744 2161311744 3413129529 4283256141 3396352313 3396352313 4283256141 3413129529 2161311744 2161311744 1523908608 869400576 2161311744 3429841466 4283256141 3413129529 2161311744 2161311744 3413129529 4283256141 3429841466 2161311744 869400576 16777216 1624571904 3262657845 3429841466 2161311744 2161311744 2161311744 2161311744 3429841466 3262657845 1624571904 16777216 16777215 232259584 1624571904 2161311744 2161311744 2161311744 2161311744 2161311744 2161311744 1624571904 232259584 16777215 16777215 16777215 16777216 869400576 1523908608 1943339008 1943339008 1523908608 869400576 16777216 16777215 16777215)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> closeIcon [

	^ Icons
		at: #closeIcon
		ifAbsentPut: [ self closeIconContents ]
]

{ #category : 'icons - contents' }
TabMorph class >> closeIconContents [

	^ Form
		extent: 12@12
		depth: 32
		fromArray: #(16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 2219658573 2555202893 16777216 16777215 16777215 16777216 2555202893 2219658573 16777215 16777215 16777215 16777215 2555202893 4283256141 2538359884 16777216 16777216 2538359884 4283256141 2555202893 16777215 16777215 16777215 16777215 16777216 2538359884 4283256141 2488159822 2488159822 4283256141 2538359884 16777216 16777215 16777215 16777215 16777215 16777215 16777216 2488159822 4283256141 4283256141 2488159822 16777216 16777215 16777215 16777215 16777215 16777215 16777215 16777216 2488159822 4283256141 4283256141 2488159822 16777216 16777215 16777215 16777215 16777215 16777215 16777216 2538359884 4283256141 2488159822 2488159822 4283256141 2538359884 16777216 16777215 16777215 16777215 16777215 2555202893 4283256141 2538359884 16777216 16777216 2538359884 4283256141 2555202893 16777215 16777215 16777215 16777215 2219658573 2555202893 16777216 16777215 16777215 16777216 2555202893 2219658573 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> closeOverIcon [

	^ Icons
		at: #closeOverIcon
		ifAbsentPut: [ self closeOverIconContents ]
]

{ #category : 'icons - contents' }
TabMorph class >> closeOverIconContents [

	^ Form
		extent: 12@12
		depth: 32
		fromArray: #(16777215 16777215 33488896 1708392448 3017015296 3872653312 3872653312 3017015296 1708392448 33488896 16777215 16777215 16777215 450363392 3218341888 4292083712 4292083712 4292083712 4292083712 4292083712 4292083712 3218341888 450363392 16777215 33488896 3218341888 4289940556 4290339683 4292018176 4292083712 4292083712 4292018176 4290339683 4289940556 3218341888 33488896 1708392448 4292083712 4290339683 4294704123 4290339683 4292018176 4292018176 4290339683 4294704123 4290339683 4292083712 1708392448 3017015296 4292083712 4292018176 4290339683 4294704123 4290338912 4290338912 4294704123 4290339683 4292018176 4292083712 3017015296 3872653312 4292083712 4292083712 4292018176 4290338912 4294704123 4294704123 4290338912 4292018176 4292083712 4292083712 3872653312 3872653312 4292083712 4292083712 4292018176 4290338912 4294704123 4294704123 4290338912 4292018176 4292083712 4292083712 3872653312 3017015296 4292083712 4292018176 4290339683 4294704123 4290338912 4290338912 4294704123 4290339683 4292018176 4292083712 3017015296 1708392448 4292083712 4290339683 4294704123 4290339683 4292018176 4292018176 4290339683 4294704123 4290339683 4292083712 1708392448 33488896 3218341888 4289940556 4290339683 4292018176 4292083712 4292083712 4292018176 4290339683 4289940556 3218341888 33488896 16777215 450363392 3218341888 4292083712 4292083712 4292083712 4292083712 4292083712 4292083712 3218341888 450363392 16777215 16777215 16777215 33488896 1708392448 3017015296 3872653312 3872653312 3017015296 1708392448 33488896 16777215 16777215)
		offset: 0@0
]

{ #category : 'accessing' }
TabMorph class >> defaultHeight [
	^ 22
]

{ #category : 'class initialization' }
TabMorph class >> initialize [

	Icons := Dictionary new
]

{ #category : 'instance creation' }
TabMorph class >> label: label icon: icon morph: morph [

	^ self new
		label: label;
		icon: icon;
		morph: morph;
		yourself
]

{ #category : 'instance creation' }
TabMorph class >> label: label icon: icon morph: morph actions: aCollection [

	^ self new
		label: label;
		icon: icon;
		morph: morph;
		addActions: aCollection;
		yourself
]

{ #category : 'instance creation' }
TabMorph class >> label: label icon: icon retrievingBlock: morph [

	^ self new
		label: label;
		icon: icon;
		retrievingBlock: morph;
		yourself
]

{ #category : 'instance creation' }
TabMorph class >> label: label icon: icon retrievingBlock: morph actions: aCollection [

	^ self new
		label: label;
		icon: icon;
		retrievingBlock: morph;
		addActions: aCollection;
		yourself
]

{ #category : 'icons' }
TabMorph class >> menuIcon [

	^ self theme windowMenuForm
]

{ #category : 'icons' }
TabMorph class >> refreshIcon1 [

	^ Icons
		at: #refreshIcon1
		ifAbsentPut: [ self refreshIcon1Contents ]
]

{ #category : 'icons' }
TabMorph class >> refreshIcon10 [

	^ Icons
		at: #refreshIcon10
		ifAbsentPut: [ self refreshIcon10Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon10Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 24965223 0 0 0 0 0 0 0 0 0 0 0 0 0 0 142401386 508995915 575841097 172795971 171609395 0 0 0 0 0 0 0 0 0 0 0 509259086 1935320144 2153357393 1918409809 1296271422 539520547 50431232 0 0 21606215 0 0 0 0 0 0 776641344 2573182807 3714821476 3664292451 2907804748 1144486963 67118080 106278475 356683834 323196477 88120119 0 0 0 87740209 861909334 2037101154 3497244267 4269653366 4285706860 3428424532 1463714105 289443895 676569674 1799588924 1799193396 574721081 0 0 191092052 980796521 2390409071 3766402420 4186226811 4252743795 4033259104 3209531208 1329168179 1028563268 2237310290 3495073867 3175911493 1162711879 119633438 91416929 846777708 2558576501 3800943236 4270507393 3917265012 3194398047 2722333759 2033218350 1143632933 1817354569 3362172510 4285312612 3814826587 1934002754 304509477 275369308 1652410738 3415199366 4287876234 4052206207 2925897567 1296534849 740581665 621232135 573074978 1885251668 3732651122 4286692985 3832458600 1984859975 186083605 477416806 2223361402 3969175947 4288204688 3614880623 1917818442 287276055 0 0 675714877 2439622753 3967926649 4286758521 3663962716 1749124155 287139352 594857318 2659305334 4069510022 4287021437 3295258721 1614710839 727693651 896978024 1164688223 2003481184 3463689836 4236427643 4168200297 2941621838 1261861682 100683264 493996646 2339881070 4001152372 4084248680 2790364488 1278640687 1416346977 2591869041 3246179186 3749494131 4219649914 4168660594 3361841499 1950516540 455238686 34165767 291223121 1751429979 3663570773 2958597968 1581287480 792431412 1719717238 3633303685 4237741966 4287613063 4001217398 3160844128 1766296129 623998507 83905280 0 90095955 810788938 1565762379 1196399687 304839716 243131760 1921372028 3650146183 4271164556 4085628798 2993334626 1431147334 472870955 16777216 0 0 0 89504329 274249039 40821860 0 210300795 1501153391 2843920249 3531390068 3228084576 2102301767 522614559 0 0 0 0 0 0 0 0 0 39777866 443994473 1165278825 1533521502 1700109134 1144751925 187403302 0 0 0 0 0 0 0 0 0 0 41145701 75955315 206613319 240495952 272141619 52661788 0 0 0 0)
		offset: 0@0
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon1Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1918411854 0 0 0 0 0 0 0 0 0 74170463 224573016 358395218 425108812 424581958 424120639 3796998729 2219545155 0 0 0 0 0 0 0 258785377 1483455585 3077815657 4033919079 4285248097 4284787292 4284326485 4285837932 4150568029 1949990196 84164352 0 0 0 0 141673060 2036971870 3984639095 4288007307 4288598421 4288992667 4288664983 4288336274 4287679624 4286298997 3846341437 924803099 0 0 0 0 1248311133 4017798768 4288729751 4288664215 4287152768 4284917343 4284193876 4283733070 4285048929 4216887635 2368696107 269899029 0 0 0 0 2774576726 4287613062 4288664471 4235966323 3528233285 1480558136 1026585898 1042836516 3929042988 2536270631 0 0 0 0 0 0 3948323406 4283800909 4283405639 3510995518 1044021042 0 0 0 2216779550 408331084 1465887829 1347788876 1330550598 1413909823 0 0 1632474693 1631948094 1631487032 1698134833 556164899 1685243238 225625702 0 0 475571792 3075645002 4148991300 4165241661 4114448694 0 0 0 0 0 0 1769128807 3815685475 761508440 424779592 642816840 3126041931 4151225958 4288139152 4286626937 3208346934 0 0 0 0 73578836 1567670373 4001810556 4287613573 4285576806 4284919134 4284655450 4286364020 4287678856 4287219330 4267285075 1798336811 0 0 0 0 560380762 3530866026 4288270224 4289255071 4289058461 4288664728 4288270738 4287350659 4285970287 4200373590 2637131819 371089436 0 0 0 0 157332566 1919332444 4084906610 4286824059 4284917599 4284325462 4283864913 4216295241 3494151486 2133749289 538729239 0 0 0 0 0 0 35359503 2102697036 3947729734 1312786232 1043626541 1026322727 891709472 572415514 169367061 0 0 0 0 0 0 0 0 39363658 1950056501 188581687 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon2 [

	^ Icons
		at: #refreshIcon2
		ifAbsentPut: [ self refreshIcon2Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon2Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 74831464 0 0 0 0 0 0 0 0 0 0 0 0 375502935 1013430619 1500298594 1433124192 963493219 0 0 0 0 0 0 0 0 0 0 1112975436 2574170212 3950690160 4102539134 3951675263 3849829998 2540221279 357737288 0 0 157067857 0 0 0 0 475439950 3998720847 4286364532 4288796057 4288992411 4288598677 4288598421 4286627702 3630279257 810851916 843749186 1884923215 0 0 0 0 894211396 2504890181 4132411207 4285575016 4236032116 4202346354 4286363765 4288532885 4287219329 4284392278 3982402390 2521535555 34755853 22126153 0 0 0 624854583 1799325241 3191768375 2420673856 2302576183 2588906569 4284193876 4286823804 4287810954 4285969519 2992151121 0 0 0 0 0 0 167784448 1060139819 438988836 0 420501771 1396342324 3998520654 4286167154 4269324659 3209070400 405170464 0 0 0 71615025 610843741 981191535 1651622758 2372779873 578474350 0 740056601 3928977196 3846801732 3376645183 2452911407 369510403 0 0 0 627686494 3413359977 3951741568 4136159614 3178347878 87208481 0 1075533848 1395222820 1093430566 285753864 185486606 34230791 0 0 0 811576660 3564813425 4288598421 4288795544 4252022374 1885251669 33576192 157861469 493140058 1532996693 409120856 0 0 0 0 0 390698305 3295128415 4270178429 4288006542 4288467605 4285378917 3143476053 3142884940 3277562707 3612055363 2051708226 777034312 71930178 0 0 0 28374419 3058011455 3042154572 3831209556 4286034800 4288270738 4286890364 4253467006 4287021439 4286692985 4266102080 3024127545 440831295 0 0 0 154367789 1295613747 354842143 1043692590 3058404934 4284193622 4286232690 4286627448 4287153537 4286363765 3948320592 2553970227 0 0 0 0 0 0 0 101601033 605445393 2017230134 3460597054 3629158730 3645541188 3108275775 1814916904 23188057 0 0 0 0 0 0 0 0 0 167781888 589785122 1075731994 907960090 337535772 136076824 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon3 [

	^ Icons
		at: #refreshIcon3
		ifAbsentPut: [ self refreshIcon3Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon3Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 592553543 660648789 341949526 190297161 0 0 0 0 0 0 0 0 0 0 290297413 1414569032 4032406865 3128146282 3010706536 1701887589 727891288 44105614 0 0 0 0 0 0 0 0 56474195 1665897795 4048919885 4287350148 4288139406 4035496062 2424030065 778682206 22654542 0 0 0 0 0 0 0 0 893157942 3242823746 4285772395 4288335249 4288664470 4186359421 2473507429 0 0 0 0 0 0 140494417 375898459 124311385 218511878 2301917998 3142686026 3983913837 4287349891 4288532628 3530930795 610053202 0 0 0 0 155625272 1231862114 3279142249 1837288311 1013365595 876381237 909014055 2336196408 3698043748 4288138639 4286167663 1868014415 16843010 0 0 0 373856064 2977085033 4170173062 4287614085 3112159092 2305671009 162594719 505703967 2857144646 4286166129 4287087999 2505810515 389779508 324709455 0 0 1867223877 3782061926 4288138383 4288795544 3916807530 1131265889 114294716 100663296 1413185333 4050496103 4287547783 4284852573 2941820751 1901700431 0 490175793 2218690104 3142949454 4219451768 4288467349 3681465444 625909317 0 588337167 2939055915 4284062291 4287088000 4269192303 3059063374 709267774 0 54033970 185162499 1144948535 3764297815 4287415685 4268667494 1398382929 0 991977244 2351655720 3746072643 4133856864 3797654870 1733201991 0 0 0 0 471951643 2991361863 4286692475 4237019011 3445729113 1968217415 510114652 994282554 858483239 2369288499 2352313904 371287323 0 0 0 0 83886080 1799126838 4150173272 4286824827 4270244222 3849302375 3259996998 1616356942 40819295 100674560 370694932 33554432 0 0 0 0 0 892169000 3376710974 4151159910 4287219330 4287284611 4100763492 2202703170 341683540 0 0 0 0 0 0 0 0 83891200 1311731754 3192424770 4032929882 4252809589 4284128339 3544221497 877171009 0 0 0 0 0 0 0 0 0 268451840 874274328 2067365173 2789311036 3058338884 2587524915 491163199 23776609 0 0 0 0 0 0 0 0 0 33569792 16777216 488464665 0 221411115 0 0 0 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon4 [

	^ Icons
		at: #refreshIcon4
		ifAbsentPut: [ self refreshIcon4Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon4Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 0 0 0 89234760 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 759994436 1381278284 592619592 122466366 0 0 0 0 0 0 0 156416323 308789596 71948342 0 239308347 1850513220 4166492751 2959716960 913029984 0 0 0 0 0 0 507481656 1651357027 2473835625 1819328102 73397069 405169955 2739310143 4285378406 3951806595 2943663465 744930394 0 0 0 255295281 1547469878 2790825554 3816405361 4153330309 2928135037 829539942 1009348388 3091565374 4285969518 4288401554 3968518528 1618198888 206683720 0 0 0 1362854965 3243744080 4237017988 4288730007 4035693441 2088223852 859472692 2151843643 3933384810 4288532628 4187279243 2340144241 342870883 0 0 0 471756567 3025968724 4287349636 4254847122 3866475882 2305933925 795787617 1093103904 3311313239 4270638468 4287876234 2910174828 476495964 0 0 0 1194818610 3663502934 4270704262 4118067052 1784983641 410110307 0 522613025 3126303569 4187080841 4220504454 2507061348 0 0 0 119556892 1765572406 4000230505 4287284611 3446386787 558536770 0 83886080 808153381 3344867159 4287021181 4235836015 1532996438 34968584 0 0 286872086 2537587002 4284983136 4253664897 3462571866 860724292 369376770 1528848670 2822405174 4067273319 4287350659 3161437031 1045141827 0 0 0 269962772 2453569336 4134316901 4287284610 3866473837 1784062797 557548084 2284546856 4031417157 4286298740 4286824827 3512574805 507745595 38385723 0 0 251741185 1949858354 3965558103 4287219074 4185898359 3327171655 1230283593 1110800432 3478097994 4285706860 4252349295 3529220179 2237178446 459255892 0 0 67120128 924803868 3058601800 4236032373 4285575529 3025904467 1045997903 151009792 2201384753 3410792008 2790758737 1817023558 793680965 59043444 0 0 0 17958931 1697739821 3360591688 4065235527 2906753337 425306448 0 471950109 1261136934 490241073 0 0 0 0 0 0 0 167787008 1028098369 2637922356 1430292537 223716686 0 33564416 16777216 0 0 0 0 0 0 0 0 0 0 288849456 156607054 0 0 0 0 0 0 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon5 [

	^ Icons
		at: #refreshIcon5
		ifAbsentPut: [ self refreshIcon5Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon5Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 36733993 288717871 0 33571840 0 0 0 0 0 0 0 0 0 0 0 0 54034738 1413055027 1900909896 1298312025 1064024160 258591069 0 0 0 0 0 0 0 0 0 0 218126080 2135395904 3479414108 3782916722 3179135348 1718533476 124705120 0 40555870 273719368 0 0 0 0 0 371617057 1228900153 3059588949 4186357631 4288269969 3885026951 1954531957 16842496 170619686 1112250179 1615961673 626173001 0 0 0 472672807 1715240758 3428621911 4118723191 4287941260 4288467603 3968584577 1551747698 589788450 1547206706 3075578186 4250510417 1751034965 0 0 219368721 2084141620 3613039444 4286298230 4270441858 4101355629 3396713578 3061105000 1449769310 1194161192 3158871617 4201557863 4118855801 2389949546 0 50331648 1210871335 3125842250 4285575017 4253664897 3715019110 1784851033 811446096 880135016 762299490 1446280237 3496322653 4287349890 4153855885 2926886249 0 184566016 1714780208 3932003671 4286955902 4135500918 2573116757 372344104 0 0 167789824 1816299835 3782258537 4288532628 4254256777 2306721138 0 0 2084470841 3983584873 4287219330 3917002864 1817683022 405171231 789663504 538465812 977044534 3143146578 4119380608 4287941772 3616328578 1618396011 0 151341316 2000321845 4016284509 4285706859 3663570261 1917688899 976056617 2469162281 2839182390 3311312216 4017796722 4287744392 4019112325 2843000427 712033637 0 0 994609987 3527904064 3763180358 2337710158 978691915 1043626031 3561392194 4217808480 4286495351 4236887424 4185438574 2490349414 862500446 34530304 0 0 456884788 2100985907 1899988791 542417739 39843158 1345483566 3696793938 4286298740 4286824827 3614290278 1952557400 659333188 0 0 0 0 0 189832265 290100547 33554431 16777216 1160671530 3309997126 3865684324 4016679522 2656476750 254117662 0 0 0 0 0 0 0 0 0 16790528 505241111 1194883634 1901172043 2270337354 2287510094 458926927 0 0 0 0 0 0 0 0 0 0 0 33570304 0 440964160 391621196 141676900 0 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon6 [

	^ Icons
		at: #refreshIcon6
		ifAbsentPut: [ self refreshIcon6Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon6Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 238519345 35020813 0 0 0 0 0 0 0 0 0 0 34619404 67128832 50331648 455899943 1446741045 608670018 0 0 0 0 0 0 0 34147080 286544913 1009544488 1144354607 1329299253 1245743161 2219479363 2908133967 2052891221 593275729 0 0 0 0 0 0 908289567 2084536634 3041758791 3545930580 3680740446 3664620903 3782718319 4135631737 3766205299 2004204651 308921436 0 0 0 0 640775725 2336589632 3898383446 4235440492 4286561656 4286955903 4287218817 4288007053 4288532885 4069707401 2759640179 862633824 0 0 0 220753701 1983478836 3697846113 4286692986 4287087487 4035035257 3715084903 3463624298 3917266546 4153593480 3565997443 1820314741 209575792 0 0 0 458068297 2722860613 4251428705 4286496118 3950623089 2640554586 1364566092 911779661 1701558879 3010773352 1786431343 693545037 83886080 154961973 90425688 18831128 876249651 2990572856 3847197768 3579683925 2740560976 1145608255 167783680 0 343463274 947572844 1112316484 1244427559 1698399028 1850381635 1347394887 0 256546115 1429963572 1598657345 1532602192 1263377987 959345706 1260215579 385890048 0 457018420 1479900462 3058734408 3814695512 4099843414 3260457806 0 0 123843675 91934319 33554407 825259563 2335931703 2989914163 1999992625 993953592 1950649150 3009323352 4001085299 4287087231 4085498492 2473243746 0 0 0 0 488727837 2118288445 3898120530 4217742687 3798377568 3547048292 3815944299 4136092031 4271821205 4288205199 3531851128 1567669606 0 0 0 101733130 908815654 3192425284 4151291753 4286759035 4286955901 4287153023 4270967176 4287875979 4069707145 3448491137 2071446124 392807517 0 0 0 0 489253666 1968017479 3664226402 4134711914 3647844710 3530864234 3497507437 3263349881 2843328879 1551352940 527156831 53856803 0 0 0 0 0 625709637 2186451274 2891489360 1431412041 978493513 979086675 778614622 594199136 225431905 0 0 0 0 0 0 0 53183778 693214791 1515889999 222733371 0 0 0 0 0 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon7 [

	^ Icons
		at: #refreshIcon7
		ifAbsentPut: [ self refreshIcon7Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon7Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 33561088 0 0 0 0 0 0 0 0 0 0 0 0 0 287730978 607287342 1127051304 1227977773 841903913 471818779 16784128 0 0 0 0 0 0 0 71471676 441357130 1899658805 2773915472 3260388943 3377829199 3008204359 1967556672 909079337 169762073 0 20350256 37198896 0 0 0 507217460 2168489272 3528890448 4252020586 4269915770 4286232434 4168463470 3865421151 2774178900 1279363642 993625395 1026916656 305694770 0 0 0 591366456 2453702200 3947926857 4218598250 4269981818 4119184253 4236427386 4286955903 4101617522 3446582374 2975571539 2253230918 592090181 0 0 0 173649746 1011257918 2169806412 3076236626 3043470686 2657397595 2993336162 3799365485 4253861508 4220569481 4135697786 3010244196 844735824 0 0 0 0 0 559722066 1313775684 1128502074 608473147 726309440 1953149792 3900555123 4288401810 4237676173 3279863925 1114750054 0 0 0 101932045 404578841 825390638 1446411058 1294494245 553926148 0 845659738 2960572779 3784166787 3566063236 2658977139 829342052 0 0 0 505307416 2067562296 2974650184 3478032457 2973136947 1142906909 0 361228663 1618200167 1702545518 1467861875 779997810 291816536 0 0 0 758808116 2857341514 4100894312 4285509481 3781140057 1967425087 472348961 456952884 976980274 1077379889 506032931 0 0 0 0 0 575377989 2757665112 4168266348 4286890620 4219320693 3563825508 2572786771 2286719559 2387382596 2638777921 1832879928 843091001 41418599 0 0 0 508336195 2253560650 3412306011 3664621926 4169318265 4270572674 4118854777 3900750969 4001216885 4084314217 3915227733 2404556106 776970055 58061673 0 0 274049353 1532667215 1263508550 1499112786 3044128103 3934569082 4271098763 4288336018 4288467347 4287481989 4051155312 3310921040 894608202 89699664 0 0 0 208323932 0 221942066 928623697 2256125807 3330459000 3616263042 3683634821 3481585273 2490809965 1315025240 257142088 0 0 0 0 0 0 0 72724301 392215381 1198703463 1517732971 1584973421 1198768743 661439073 33604352 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon8 [

	^ Icons
		at: #refreshIcon8
		ifAbsentPut: [ self refreshIcon8Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon8Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 121476406 490769208 424580170 640578858 236610840 102324245 0 0 0 0 0 0 0 0 0 39634005 658475576 2168357685 2739703622 2639105864 1951174214 1093431335 337733150 0 0 0 0 0 0 0 0 44105625 960663098 3074854207 4149976404 4235309163 3731334752 2974781513 1429896245 303520019 0 0 0 0 0 0 17466368 0 491954761 2287312717 3865685345 4286627448 4286824315 4016876132 2941095495 1060469040 33563904 0 0 0 0 101208064 438462237 337009682 323590977 1381344843 2875041620 3614881901 4119250046 4286495862 3781600864 1850182209 303059978 0 0 0 54894397 708345138 2034205242 2135065918 1312455989 1178043441 1145476668 1851565651 3161371238 4169318523 4152014708 2740624468 640777003 0 0 0 273126975 1817549135 3462307928 3831669597 3394080840 1949266476 739727124 355040032 1734453848 3799365485 4286824572 3446582630 1531613506 556563239 70550575 89504327 978295622 2774311253 4134711916 4286167154 3999244121 2503309106 621233415 0 1113764439 3396975727 4287744393 4018388348 3042811733 1698859836 473269295 174242644 1549444431 2623316819 3899502950 4253336188 3933253225 2000979519 252401416 83886046 1450164835 3615343475 4271624594 4287613064 3446780265 1683200332 289969988 46202788 358395728 994876227 2590486111 4152541049 4068259700 2589695317 641239090 358266957 1567868519 2844118139 3918647175 3868117893 2843196014 828090450 56409427 0 0 205297460 1885777756 3833577077 4287349890 3581063532 2320339784 1346078003 1061261625 1315946596 2022035324 2558313843 1366737515 292405089 0 0 0 54508600 1013298780 3145777782 4254256010 4220372613 3715741297 2891422287 1916568886 539389728 327343990 561368681 308988255 0 0 0 0 0 342016086 2239546481 3784034945 4238070419 4287875722 4118000235 3042154571 1060865588 16777216 56081483 0 0 0 0 0 0 107733085 997245796 2340538487 3650080389 4136684679 4269850489 3781141847 1699715911 106808146 0 0 0 0 0 0 0 0 110034812 863028837 1736230768 2743059572 2977348718 3344607058 1414635593 257406030 0 0 0 0)
		offset: 0@0
]

{ #category : 'icons' }
TabMorph class >> refreshIcon9 [

	^ Icons
		at: #refreshIcon9
		ifAbsentPut: [ self refreshIcon9Contents ]
]

{ #category : 'icons - contents' }
TabMorph class >> refreshIcon9Contents [

	^ Form
		extent: 16@16
		depth: 32
		fromArray: #(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 289575996 440372534 155686977 0 0 0 0 0 0 0 0 36936489 67128576 67528960 0 323524927 1396738360 2218755126 1196134469 371815206 33575424 0 0 0 0 89638474 223059779 809798206 1211595570 573009187 67124992 575906634 2672398658 3746731595 3109262669 1665304126 219965722 0 0 0 157664086 928161864 1817615695 2656870230 3008533837 2017493820 540507697 1029089356 2925504599 4285246819 4201820524 2824510035 1077048877 118840593 0 0 409253207 1901699919 3126961753 4117868907 4083919974 3243414605 1396277044 1296669248 2925504854 4068260979 4286758522 3697517148 1950384955 321021983 0 0 139703111 1078893636 3261574496 4269653366 4269060973 3612447564 1898934828 909147433 1868342866 3632053619 4287021950 3983256163 2303100992 488924704 0 0 0 1214032211 3144988267 4270112891 3933253225 2722333759 1293901597 335556864 1062379337 3178148454 4236427643 4016876389 2336852803 488991521 0 0 223787853 1684780641 3800022645 4236492411 3177752417 1262124853 167776000 0 1046063183 3228677481 4286692986 3765415529 1816627777 253648920 0 0 291422802 2323432049 3985426563 4186489472 2909054558 658082099 46332305 678544995 2003876453 3766205554 4270113149 3362302305 1246005823 83890432 0 0 661702499 2625685109 4170304648 4203661190 3160909921 1379567156 744470611 1853409644 3565012083 4204055948 4186555010 2942937441 892896305 35016724 0 0 511103337 2273429879 3952529805 4288138895 3681923693 2152238657 1061130039 1971178099 3700412293 4288270481 4152935041 3109986390 1346341177 153255454 0 0 308922717 1652476530 3633237636 4287810441 4151751789 2723058502 1043496236 1182123370 2827669377 3817786501 3548101491 2455741272 1212123705 254903339 0 0 0 846645864 2692793717 3867460732 4151226471 2639304264 640317220 277145719 1568393586 2172372081 1802680424 844275274 273588554 54040627 0 0 0 208264538 1131594088 2708322149 3579553363 1867619657 289311798 31260606 275698785 494127719 276287082 73979227 0 0 0 0 0 0 224640601 844869458 1431610443 760259400 0 0 0 0 0 0 0 0 0)
		offset: 0@0
]

{ #category : 'private - constants' }
TabMorph >> actionOffset [

	^ 4 * self displayScaleFactor
]

{ #category : 'accessing' }
TabMorph >> actions [

	^ actions
]

{ #category : 'protocol' }
TabMorph >> actions: aCollection [

	actions := aCollection.
	self triggerEvent: #actionsChanged with: self
]

{ #category : 'protocol' }
TabMorph >> addAction: anAction [

	actions add: anAction
]

{ #category : 'protocol' }
TabMorph >> addActions: aCollection [

	actions addAll: aCollection
]

{ #category : 'icons - actions' }
TabMorph >> addActionsToIcon [

	closeIcon
		on: #mouseEnter send: #mouseEnterIcon to: self;
		on: #click send: #close to: self;
		on: #mouseLeave send: #mouseLeaveIcon to: self
]

{ #category : 'private - icons' }
TabMorph >> addIcon [

	self
		addMorph: closeIcon
		fullFrame: (LayoutFrame identity
			bottomFraction: 0;
			leftFraction: 1;
			topOffset: 6 * self displayScaleFactor;
			leftOffset: self iconRightOffset negated - (12 * self displayScaleFactor);
			rightOffset: self iconRightOffset negated;
			bottomOffset: (18 * self displayScaleFactor);
			yourself)
]

{ #category : 'private' }
TabMorph >> addLabel [

	self
		addMorph: label
		fullFrame: (LayoutFrame identity
			topFraction: 1;
			leftOffset: self labelRightOffset;
			topOffset: (label height negated - self labelBottomOffset) + 2;
			yourself)
]

{ #category : 'private' }
TabMorph >> addRefreshMenuItemOn: aMenu [
	"I have a block for retrieving my contents, so I install a menu action for this"

	retrievingBlock ifNil: [ ^ self ].
	aMenu addLine.
	aMenu
		add: 'Refresh content'
		target: self
		selector: #refreshContent
]

{ #category : 'private' }
TabMorph >> addToSelection [

	self triggerEvent: #tabAddedToSelection with: self.

	"No need to change here since the toolbar I belong to will do it"
]

{ #category : 'private - drawing' }
TabMorph >> backgroundColor [
	^ state backgroundColor
]

{ #category : 'meta-actions' }
TabMorph >> blueButtonUp: anEvent [
	super blueButtonUp: anEvent.
	self close
]

{ #category : 'private - drawing' }
TabMorph >> borderColor [
	"I do not use #borderColor because I want a light border"
	^ self theme lightBackgroundColor
]

{ #category : 'private - drawing' }
TabMorph >> buildBorderVertices [

	^ state buildBorderVertices
]

{ #category : 'private' }
TabMorph >> buildLabel: text withIcon: icon [

	^ (TabLabelItemMorph tab: self)
		morph:	text asMorph;
		icon: (AlphaImageMorph new image: icon);
		yourself
]

{ #category : 'private - drawing' }
TabMorph >> buildVerticesFrom: borderVertices [

	^ state buildVerticesFrom: borderVertices
]

{ #category : 'protocol' }
TabMorph >> close [

	closeable ifFalse: [ ^ self ].
	self okToClose ifFalse: [ ^self ].
	self delete
]

{ #category : 'accessing' }
TabMorph >> closeable [
	^ closeable
]

{ #category : 'protocol' }
TabMorph >> closeable: anObject [

	closeable := anObject.
	anObject
		ifTrue: [ self showCloseIcon ]
		ifFalse: [ self hideCloseIcon ]
]

{ #category : 'accessing - defaults' }
TabMorph >> defaultBounds [
	^ 0@0 corner: (100@(self class defaultHeight)) * self displayScaleFactor
]

{ #category : 'private - icons' }
TabMorph >> defaultIcon [
	^ self iconNamed: #blankIcon
]

{ #category : 'protocol' }
TabMorph >> delete [

	super delete.
	morph ifNotNil: [morph delete].
	retrievingProcess ifNotNil: [ retrievingProcess terminate ].
	self triggerEvent: #tabDeleted with: self
]

{ #category : 'drawing' }
TabMorph >> drawOn: aCanvas [
	| borderVertices vertices |

	borderVertices := self buildBorderVertices.
	vertices := self buildVerticesFrom: borderVertices.

	aCanvas
		drawPolygon: vertices
		color: self backgroundColor
		borderWidth: 0
		borderColor: Color transparent.

	borderVertices overlappingPairsDo: [ :start :end |
		aCanvas
			line: start
			to: end
			width: 1
			color: self borderColor ]
]

{ #category : 'accessing' }
TabMorph >> enabled [

	^ state enabled
]

{ #category : 'protocol' }
TabMorph >> enabled: aBoolean [

	(state isEnabledMatchingTheState: aBoolean) ifTrue: [ ^ self ].

	state := state newStateForEnabled: aBoolean.
	label enabled: aBoolean.
	self changed
]

{ #category : 'protocol' }
TabMorph >> extraSpaceForActions [
	| space offsets |

	space := 0.
	offsets := 1.

	self hasMenu ifTrue: [
		offsets := offsets +1.
		space := space + self menuIcon width ].

	self actions do: [ :each |
		space := space + each icon width.
		offsets := offsets +1 ].

	^ space + (offsets * self actionOffset)
]

{ #category : 'events - processing' }
TabMorph >> handleMouseUp: anEvent [
	anEvent blueButtonChanged
		ifTrue: [ self blueButtonUp: anEvent ]
		ifFalse: [ super handleMouseUp: anEvent ]
]

{ #category : 'events - handling' }
TabMorph >> handlesMouseDown: event [

	^ true
]

{ #category : 'protocol' }
TabMorph >> hasActions [

	^ actions notEmpty
]

{ #category : 'protocol' }
TabMorph >> hasMenu [

	^ menu isNotNil or: [ retrievingBlock isNotNil ]
]

{ #category : 'protocol' }
TabMorph >> hideCloseIcon [

	closeIcon hide
]

{ #category : 'protocol' }
TabMorph >> icon [

	^ label icon
]

{ #category : 'protocol' }
TabMorph >> icon: anIcon [

	anIcon
		ifNil: [ label icon: nil ]
		ifNotNil: [ label icon: (AlphaImageMorph new image: anIcon) ]
]

{ #category : 'private - constants' }
TabMorph >> iconRightOffset [

	^ 10 * self displayScaleFactor
]

{ #category : 'initialization' }
TabMorph >> initialize [
	super initialize.

	self changeProportionalLayout.

	state := TabEnabledState tab: self.
	closeable := true.
	label := self buildLabel: 'tab' withIcon: self defaultIcon.
	closeIcon := AlphaImageMorph withForm: self class closeIcon scaledByDisplayScaleFactor.
	actions := OrderedCollection new.
	retrievingSemaphore := Semaphore new.

	self addLabel.
	self addIcon.
	self addActionsToIcon
]

{ #category : 'accessing' }
TabMorph >> label [
	^ label
]

{ #category : 'protocol' }
TabMorph >> label: aString [

	label morph: aString asMorph
]

{ #category : 'private - constants' }
TabMorph >> labelBottomOffset [

	^ 5 * self displayScaleFactor
]

{ #category : 'private - constants' }
TabMorph >> labelRightOffset [

	^ 12 * self displayScaleFactor
]

{ #category : 'accessing' }
TabMorph >> menu [
	| newMenu |

	newMenu := MenuMorph new defaultTarget: self.
	menu ifNotNil: [ menu cull: newMenu ].

	self addRefreshMenuItemOn: newMenu.

	^ newMenu
]

{ #category : 'protocol' }
TabMorph >> menu: aMenu [

	menu := aMenu
]

{ #category : 'private - icons' }
TabMorph >> menuIcon [

	^ self class menuIcon
]

{ #category : 'accessing' }
TabMorph >> model [

	^ model
]

{ #category : 'accessing' }
TabMorph >> model: aModel [

	model := aModel
]

{ #category : 'private - tab label' }
TabMorph >> modifyClippingBounds: clippingBounds [
	| rightOffset |

	rightOffset := -10.
	closeIcon visible ifTrue: [ rightOffset := rightOffset - 14 ].

	^ clippingBounds withRight: (clippingBounds right + rightOffset) * self displayScaleFactor
]

{ #category : 'accessing' }
TabMorph >> morph [

	^ morph
]

{ #category : 'protocol' }
TabMorph >> morph: anObject [

	morph := anObject.
	self triggerEvent: #tabRefreshed with: self
]

{ #category : 'events - handling' }
TabMorph >> mouseDown: event [
	self flag: #pharoTodo. "Add drag"
]

{ #category : 'icons - actions' }
TabMorph >> mouseEnterIcon [

	closeable ifFalse: [ ^ self ].
	fadeOut ifNotNil: [ fadeOut terminate ].
	closeIcon image: self class closeOverIcon
]

{ #category : 'icons - actions' }
TabMorph >> mouseLeaveIcon [

	closeable ifFalse: [ ^ self ].
	fadeOut ifNotNil: [ fadeOut terminate ].
	fadeOut := [
		closeIcon image: self class closeHalfOverIcon.
		(Delay forMilliseconds: 50) wait.
		closeIcon image: self class closeIcon ] fork
]

{ #category : 'events - handling' }
TabMorph >> mouseUp: event [

	(event commandKeyPressed or: [ event controlKeyPressed ])
		ifTrue: [ self toggleSelection ]
		ifFalse: [
			event shiftPressed
				ifTrue: [ self selectToMe ]
				ifFalse: [ self selected: true ] ]
]

{ #category : 'protocol' }
TabMorph >> okToClose [
	model ifNil: [ ^true ].
	^model okToClose
]

{ #category : 'private' }
TabMorph >> refreshContent [

	morph := nil.
	self triggerEvent: #tabEmptyContents with: self.

	"Trigger the update"
	self softRetrieveMorph
]

{ #category : 'private' }
TabMorph >> removeFromSelection [

	self triggerEvent: #tabRemovedFromSelection with: self.

	"No need to change here since the toolbar I belong to will do it"
]

{ #category : 'protocol' }
TabMorph >> retrieveMorph: aBlock [
	"This is a hard request. The result is blocking contrary to softRetrieveMorph.
	Late binding so the morph may be built only on demand"

	morph ifNotNil: [
		aBlock value: morph.
		^ nil ].
	retrievingSemaphore isSignaled
		ifFalse: [ self softRetrieveMorph ].

	^ [ retrievingSemaphore wait.
		morph ifNotNil: [
			self morphicUIManager defer: [aBlock value: morph ]]]
				fork
]

{ #category : 'accessing' }
TabMorph >> retrievingBlock: anObject [

	retrievingBlock := anObject.
	retrievingBlock ifNotNil: [ self softRetrieveMorph ]
]

{ #category : 'private' }
TabMorph >> selectToMe [

	self triggerEvent: #tabSelectTo with: self.

	"No need to change here since the toolbar I belong to will do it"
]

{ #category : 'accessing' }
TabMorph >> selected [

	^ state selected
]

{ #category : 'protocol' }
TabMorph >> selected: aBoolean [

	(state isSelectedMatchingTheState: aBoolean)
		ifTrue: [ ^ self triggerEvent: #tabResetSelection with: self ].

	state := state newStateForSelected: aBoolean.
	aBoolean
		ifTrue: [
			self triggerEvent: #tabSelected with: self.
			self showCloseIcon ].

	"No need to change here since the toolbar Ibelong to will do it"
]

{ #category : 'accessing' }
TabMorph >> setActionsFrom: aBlock [

	self actions: aBlock value
]

{ #category : 'protocol' }
TabMorph >> showCloseIcon [

	closeable
		ifTrue: [ closeIcon show ]
]

{ #category : 'private - tab label' }
TabMorph >> showIconTreshold [

	^ (closeIcon visible
		ifTrue: [ 54 ]
		ifFalse: [ 40 ]) * self displayScaleFactor
]

{ #category : 'protocol' }
TabMorph >> silentlySelected: aBoolean [

	(state isSelectedMatchingTheState: aBoolean)
		ifTrue: [ ^ self ].

	state := state newStateForSelected: aBoolean.
	aBoolean
		ifTrue: [ self showCloseIcon ].

	"No need to change here since the toolbar Ibelong to will do it"
]

{ #category : 'protocol' }
TabMorph >> softRetrieveMorph [
	| oldIcon |
	"Like retrieveMorph but done in a separated process"
	morph ifNotNil: [ ^ self ].
	retrievingProcess
		ifNotNil: [
			"The retrieving process is already running, let's wait for its result"
			retrievingProcess isTerminated
				ifFalse: [ ^ self ] ].

	oldIcon := self icon ifNotNil: [ :i | i form ].
	label icon: TabBuildingIconMorph new.
	retrievingProcess := [ [
		morph := retrievingBlock value]
	ensure: [
		self morphicUIManager defer: [
			self icon: oldIcon.
			self triggerEvent: #tabRefreshed with: self].
		"I should signal all waiters here"
		[retrievingSemaphore isEmpty] whileFalse: [ retrievingSemaphore signal].
	] ] forkAt: Processor activePriority - 2
]

{ #category : 'protocol' }
TabMorph >> themeChanged [
	super themeChanged.
	morph ifNotNil: #themeChanged
]

{ #category : 'private' }
TabMorph >> toggleSelection [

	self selected
		ifTrue: [ self removeFromSelection ]
		ifFalse: [ self addToSelection ]
]

{ #category : 'protocol' }
TabMorph >> updateShowIcon [

	(self selected not and: [ self width < 100 ])
		ifTrue: [ self hideCloseIcon ]
		ifFalse: [ self showCloseIcon ]
]

{ #category : 'protocol' }
TabMorph >> waitReadyMorphFor: timeoutDuration [
	"This method allow wait some small duration until morph will be ready.
	Clients could use it to not show loading progress if it is really fast process.
	Instead some blinking could happen"

	morph ifNotNil: [ ^ self ].
	retrievingSemaphore waitTimeoutMilliseconds:
		timeoutDuration asMilliSeconds
]
